<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ include file="../common.inc" %>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="./css/style1.css" rel="stylesheet" type="text/css" />

<script language="JavaScript" src="./js/FusionCharts.js"></script>
<script language="JavaScript" src="./js/sale-monitor_demo.js"></script>
<script type="text/javascript" src="./js/form.js"></script>
<script type="text/javascript">
	var industryslast = new Array();
	<c:forEach items="${all}" var="item" varStatus="s" >
		<c:choose>
		<c:when test="${!empty item.lastnewcustomercount}">
		industryslast.push(${item.lastnewcustomercount});
		</c:when>
		<c:otherwise>
		industryslast.push(0);
		</c:otherwise>
		</c:choose>
	</c:forEach>
	var industrysthis = new Array();
	<c:forEach items="${all}" var="item" varStatus="s" >
		<c:choose>
		<c:when test="${!empty item.thisnewcustomercount}">
		industrysthis.push(${item.thisnewcustomercount});
		</c:when>
		<c:otherwise>
		industrysthis.push(0);
		</c:otherwise>
		</c:choose>
	</c:forEach>
	var industryslast1 = new Array();
	<c:forEach items="${all}" var="item" varStatus="s" >
		<c:choose>
		<c:when test="${!empty item.lastmonthnewcontractcount}">
		industryslast1.push(${item.lastmonthnewcontractcount});
		</c:when>
		<c:otherwise>
		industryslast1.push(0);
		</c:otherwise>
		</c:choose>
	</c:forEach>
	var industrysthis1 = new Array();
	<c:forEach items="${all}" var="item" varStatus="s" >
		<c:choose>
		<c:when test="${!empty item.thismonthnewcontractcount}">
		industrysthis1.push(${item.thismonthnewcontractcount});
		</c:when>
		<c:otherwise>
		industrysthis1.push(0);
		</c:otherwise>
		</c:choose>
	</c:forEach>
	var industryslast2 = new Array();
	<c:forEach items="${all}" var="item" varStatus="s" >
		<c:choose>
		<c:when test="${!empty item.lastmonthtotalcontractCost}">
		industryslast2.push(${item.lastmonthtotalcontractCost});
		</c:when>
		<c:otherwise>
		industryslast2.push(0);
		</c:otherwise>
		</c:choose>
	</c:forEach>
	var industrysthis2 = new Array();
	<c:forEach items="${all}" var="item" varStatus="s" >
		<c:choose>
		<c:when test="${!empty item.thismonthtotalcontractCost}">
		industrysthis2.push(${item.thismonthtotalcontractCost});
		</c:when>
		<c:otherwise>
		industrysthis2.push(0);
		</c:otherwise>
		</c:choose>
	</c:forEach>
	var industryslast3 = new Array();
	<c:forEach items="${all}" var="item" varStatus="s" >
		<c:choose>
		<c:when test="${!empty item.lastmonthtotalbackCost}">
		industryslast3.push(${item.lastmonthtotalbackCost});
		</c:when>
		<c:otherwise>
		industryslast3.push(0);
		</c:otherwise>
		</c:choose>
	</c:forEach>
	var industrysthis3 = new Array();
	<c:forEach items="${all}" var="item" varStatus="s" >
		<c:choose>
		<c:when test="${!empty item.thismonthtotalbackCost}">
		industrysthis3.push(${item.thismonthtotalbackCost});
		</c:when>
		<c:otherwise>
		industrysthis3.push(0);
		</c:otherwise>
		</c:choose>
	</c:forEach>

	var t1 = new Array();
	var t2 = new Array();
	var t3 = new Array();
	var t4 = new Array();
	<c:forEach items="${all}" var="item" varStatus="s" >
		t1.push(${item.addedPecentnewcustomercount});
	</c:forEach>
	<c:forEach items="${all}" var="item" varStatus="s" >
		t2.push(${item.addedPecentmonthnewcontractcount});
	</c:forEach>
	<c:forEach items="${all}" var="item" varStatus="s" >
		t3.push(${item.addedPecentmonthtotalcontractCost});
	</c:forEach>
	<c:forEach items="${all}" var="item" varStatus="s" >
		t4.push(${item.addedPecentmonthtotalbackCost});
	</c:forEach>
	
	function changeImg(id){
		if(id == 1){
			document.getElementById("img1").className = "btn_back";
			document.getElementById("img2").className = "btn_submit";
			document.getElementById("img3").className = "btn_submit";
			document.getElementById("img4").className = "btn_submit";
			document.getElementById("img5").className = "btn_submit"; 
			document.getElementById("div1").style.display = "block";
			document.getElementById("div2").style.display = "none";
			document.getElementById("div3").style.display = "none";
			document.getElementById("div4").style.display = "none";
			document.getElementById("div5").style.display = "none";
		}else if(id == 2){
			document.getElementById("img2").className = "btn_back";
			document.getElementById("img1").className = "btn_submit";
			document.getElementById("img3").className = "btn_submit";
			document.getElementById("img4").className = "btn_submit";
			document.getElementById("img5").className = "btn_submit"; 
			document.getElementById("div2").style.display = "block";
			document.getElementById("div1").style.display = "none";
			document.getElementById("div3").style.display = "none";
			document.getElementById("div4").style.display = "none";
			document.getElementById("div5").style.display = "none";
		}else if(id == 3){
			document.getElementById("img3").className = "btn_back";
			document.getElementById("img1").className = "btn_submit";
			document.getElementById("img2").className = "btn_submit";
			document.getElementById("img4").className = "btn_submit";
			document.getElementById("img5").className = "btn_submit"; 
			document.getElementById("div3").style.display = "block";
			document.getElementById("div1").style.display = "none";
			document.getElementById("div2").style.display = "none";
			document.getElementById("div4").style.display = "none";
			document.getElementById("div5").style.display = "none";
		}else if(id == 4){
			document.getElementById("img4").className = "btn_back";
			document.getElementById("img3").className = "btn_submit";
			document.getElementById("img1").className = "btn_submit";
			document.getElementById("img2").className = "btn_submit";
			document.getElementById("img5").className = "btn_submit"; 
			document.getElementById("div4").style.display = "block";
			document.getElementById("div1").style.display = "none";
			document.getElementById("div2").style.display = "none";
			document.getElementById("div3").style.display = "none";
			document.getElementById("div5").style.display = "none";
		}else if(id == 5){
			document.getElementById("img5").className = "btn_back";
			document.getElementById("img3").className = "btn_submit";
			document.getElementById("img1").className = "btn_submit";
			document.getElementById("img2").className = "btn_submit";
			document.getElementById("img4").className = "btn_submit";
			document.getElementById("div5").style.display = "block";
			document.getElementById("div1").style.display = "none";
			document.getElementById("div2").style.display = "none";
			document.getElementById("div3").style.display = "none";
			document.getElementById("div4").style.display = "none";
		}
	}
	function createReport(){
		
		document.newsNoticeForm.action = "./manageReport.do?action=marketExpandsAnalysis";
		document.newsNoticeForm.target = "main";
		document.newsNoticeForm.submit();
		
	}
	function back(){
		window.location.href = "./manageReport.do";
		window.location.target = "main";
	}
	function aaa(aaa){
		window.location.href = aaa;
		window.location.target = "main";
		}
</script>
</head>
<body>
<form name="newsNoticeForm" action="" method="post">
	<table class="table_frame">
		<tr>
			<td>
				<table class="table_title2">
					<tr>
						<td>
							<table cellpadding="0" cellspacing="0" width="100%" height="100%">
								<tr>
									<td class="title_lab">分析报表</td>
									<td align="left">&nbsp;&nbsp;快速查看：
									<select onchange="aaa(this.options[this.selectedIndex].value);">
									<option>-------------请选择-------------</option>
									<option value="./manageReport.do?action=preSalePeriodReport">销售周期分析表</option>
									<option value="./manageReport.do?action=saleMonthReport">销售月度统计表</option>
									<option value="./manageReport.do?action=allCustomerDevoteAnalysis">客户贡献统计表</option>
									<option value="./manageReport.do?action=oldCustomerDevoteAnalysis">老客户贡献分析表</option>
									<option value="./manageReport.do?action=marketExpandsAnalysis">市场开拓同步分析表</option>
									<option value="./manageReport.do?action=annualWreathCompares">年度环比分析表</option>
									<option value="./manageReport.do?action=getLinkManMailInfo">联系人邮件列表</option>
									<option value="./manageReport.do?action=CustomerStatisticContract">按客户统计合同</option>
									<option value="./manageReport.do?action=saleStatisticContract">按销售统计合同</option>
									
									</select>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr><td style="height: 55px;text-align: center;font-weight: bold;font-size: 24px;">市场开拓同比分析表</td></tr>
					<tr>
						<td align="center">
							<table class="table_report1" cellpadding="0" cellspacing="0" height="100%" style="width: 95%;">
								<tr>
									<td align="center" height="30">
										<input class="btn_report" type="button" value="" onclick="createReport()"/>&nbsp;&nbsp;
										<button class="btn_back" onclick="back()" hidefocus="true">返回</button>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td align="center">
						
								<!-- 开始 -->	
								<table class="table_sreport" style="width: 98%;">
									<tr>
										<td  class="title"></td>
										<td colspan="4" class="title" align="center">上年度(${lastyear })</td>
										<td colspan="4" class="title" align="center">本年度(${thisyear })</td>
										<td colspan="4" class="title" align="center">同比增幅</td>
									</tr>
									<tr>
										<td class="title">月度</td>
										<td class="title">新增客户</td>
										<td class="title">新增合同</td>
										<td class="title">签约金额</td>
										<td class="title">回款</td>
										<td class="title">新增客户</td>
										<td class="title">新增合同</td>
										<td class="title">签约金额</td>
										<td class="title">回款</td>
										<td class="title">新增客户</td>
										<td class="title">新增合同</td>
										<td class="title">签约金额</td>
										<td class="title">回款</td>
									</tr>
									<c:forEach items="${all}" var="item" >
									<tr onmouseover="onmousemoveChange(this,'img${item.monthId}')" onmouseout="onmouseoutChange(this,'img${item.monthId}')">
										<td>${item.monthId }月</td>
										<td>
										<c:choose>
											<c:when test="${!empty item.lastnewcustomercount}">
												${item.lastnewcustomercount }
											</c:when>
											<c:otherwise>
												0
											</c:otherwise>
										</c:choose>
										</td>
										<td>
										<c:choose>
											<c:when test="${!empty item.lastmonthnewcontractcount}">
												${item.lastmonthnewcontractcount }
											</c:when>
											<c:otherwise>
												0
											</c:otherwise>
										</c:choose>
										</td>
										<td>￥
										<c:choose>
												<c:when test="${!empty item.lastmonthtotalcontractCost}">
													<fmt:formatNumber value="${item.lastmonthtotalcontractCost }" pattern="###,###,###,###.##"/>
												</c:when>
												<c:otherwise>
													0
												</c:otherwise>
											</c:choose>
										</td>
										<td>￥
										<c:choose>
												<c:when test="${!empty item.lastmonthtotalbackCost}">
													<fmt:formatNumber value="${item.lastmonthtotalbackCost }" pattern="###,###,###,###.##"/>
												</c:when>
												<c:otherwise>
													0
												</c:otherwise>
											</c:choose>
										</td>
										<td>
										<c:choose>
											<c:when test="${!empty item.thisnewcustomercount}">
												${item.thisnewcustomercount }
											</c:when>
											<c:otherwise>
												0
											</c:otherwise>
										</c:choose>
										</td>
										<td>
										<c:choose>
											<c:when test="${!empty item.thismonthnewcontractcount}">
												${item.thismonthnewcontractcount }
											</c:when>
											<c:otherwise>
												0
											</c:otherwise>
										</c:choose>
										</td>
										<td>￥
										<c:choose>
												<c:when test="${!empty item.thismonthtotalcontractCost}">
													<fmt:formatNumber value="${item.thismonthtotalcontractCost }" pattern="###,###,###,###.##"/>
												</c:when>
												<c:otherwise>
													0
												</c:otherwise>
											</c:choose>
										</td>
										<td>￥
										<c:choose>
												<c:when test="${!empty item.thismonthtotalbackCost}">
													<fmt:formatNumber value="${item.thismonthtotalbackCost }" pattern="###,###,###,###.##"/>
												</c:when>
												<c:otherwise>
													0
												</c:otherwise>
											</c:choose>
										</td>
										<td><fmt:formatNumber value="${item.addedPecentnewcustomercount }" pattern="######" />%</td>
										<TD><fmt:formatNumber value="${item.addedPecentmonthnewcontractcount }" pattern="######" />%</TD>
										<td><fmt:formatNumber value="${item.addedPecentmonthtotalcontractCost }" pattern="######" />%</td>
										<td><fmt:formatNumber value="${item.addedPecentmonthtotalbackCost }" pattern="######" />%</td>
									</tr>
									</c:forEach>
									<tr>
										<td>合计</td>
										<td>
										
										<c:choose>
												<c:when test="${!empty totalcustomerL.totalnewcustomercount}">
													${totalcustomerL.totalnewcustomercount }
												</c:when>
												<c:otherwise>
													0
												</c:otherwise>
											</c:choose>
										</td>
										<td>
										<c:choose>
												<c:when test="${!empty totalcontractL.yearnewcustomercount }">
													${totalcontractL.yearnewcustomercount }
												</c:when>
												<c:otherwise>
													0
												</c:otherwise>
											</c:choose>
										</td>
										<td>
										￥
										<c:choose>
												<c:when test="${!empty totalcontractL.yeartotalcontractCost}">
													<fmt:formatNumber value="${totalcontractL.yeartotalcontractCost }" pattern="###,###,###,###.##"/>
												</c:when>
												<c:otherwise>
													0
												</c:otherwise>
											</c:choose>
										</td>
										<td>
										￥
										<c:choose>
												<c:when test="${!empty totalcontractL.yeartotalbackCost}">
													<fmt:formatNumber value="${totalcontractL.yeartotalbackCost }" pattern="###,###,###,###.##"/>
												</c:when>
												<c:otherwise>
													0
												</c:otherwise>
											</c:choose>
										</td>
										<td>
											<c:choose>
												<c:when test="${!empty totalcustomerT.totalnewcustomercount }">
													${totalcustomerT.totalnewcustomercount }
												</c:when>
												<c:otherwise>
													0
												</c:otherwise>
											</c:choose>
										
										</td>
										<td>
										<c:choose>
												<c:when test="${!empty totalcontractT.yearnewcustomercount }">
													${totalcontractT.yearnewcustomercount }
												</c:when>
												<c:otherwise>
													0
												</c:otherwise>
											</c:choose>
										
										</td>
										<td>
										￥
										<c:choose>
												<c:when test="${!empty totalcontractT.yeartotalcontractCost}">
													<fmt:formatNumber value="${totalcontractT.yeartotalcontractCost }" pattern="###,###,###,###.##"/>
												</c:when>
												<c:otherwise>
													0
												</c:otherwise>
											</c:choose>
										</td>
										<td>
										￥
										<c:choose>
												<c:when test="${!empty totalcontractT.yeartotalbackCost}">
													<fmt:formatNumber value="${totalcontractT.yeartotalbackCost }" pattern="###,###,###,###.##"/>
												</c:when>
												<c:otherwise>
													0
												</c:otherwise>
											</c:choose>
										</td>
										<td><fmt:formatNumber value="${mt.totalAddedCustomerCount }" pattern="######" />%</td>
										<td><fmt:formatNumber value="${mt.totalAddedContractCount }" pattern="######" />%</td>
										<td><fmt:formatNumber value="${mt.totalAddedContractCost}" pattern="######" />%</td>
										<td><fmt:formatNumber value="${mt.totalAddedContractBackCost}" pattern="######" />%</td>
									</tr>
								</table>
								<!-- 结束 -->
						</td>
					</tr>
					
					<tr><td><br></td></tr>
					<tr>
						<td class="title_info" style="text-align: center;">图形分析</td>
					</tr>
					<tr>
						<td align="center">
							<table class="table_report1" cellpadding="0" cellspacing="0" height="100%" style="width: 95%;text-align: left;">
								<tr>
									<td align="" height="30">
										<button id="img1" class="btn_back" onclick="changeImg(1)" hidefocus="true">按客户</button>
										<button id="img2" class="btn_submit" onclick="changeImg(2)" hidefocus="true">按合同</button>
										<button id="img3" class="btn_submit" onclick="changeImg(3)" hidefocus="true">按签约金额</button>
										<button id="img4" class="btn_submit" onclick="changeImg(4)" hidefocus="true">按回款</button>
										<button id="img5" class="btn_submit" onclick="changeImg(5)" hidefocus="true">综合</button>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td height="200" align="center" >
							<table class="table" style="width: 95%;text-align: center;">
								<tr>
									<td align="center">
										<div id="div1" style="display: block;">
											<div id="chartdiv11" align="center">按客户</div>
											<script type="text/javascript">
												xianghm1("chartdiv11",industryslast,industrysthis,${thisyear},${lastyear});
											</script>
										</div>
										<div id="div2" style="display: none;">
											<div id="chartdiv22" align="center">按合同</div>
											<script type="text/javascript">
											xianghm1("chartdiv22",industryslast1,industrysthis1,${thisyear},${lastyear});
											</script>
										</div>
										<div id="div3" style="display: none;">
											<div id="chartdiv33" align="center">按签约金额</div>
											<script type="text/javascript">
											xianghm1("chartdiv33",industryslast2,industrysthis2,${thisyear},${lastyear});
											</script>
										</div>
										<div id="div4" style="display: none;">
											<div id="chartdiv44" align="center">按回款</div>
											<script type="text/javascript">
											xianghm1("chartdiv44",industryslast3,industrysthis3,${thisyear},${lastyear});
											</script>
										</div>
										<div id="div5" style="display: none;">
										<div id="chartdiv55" align="center">综合</div>
										<script type="text/javascript">
											xianghm2("chartdiv55",t1,t2,t3,t4,${thisyear},${lastyear},"市场开拓同比分析(综合)");
										</script>
										</div>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	</form>											
</body>
</html>